#!/usr/bin/env python2

# GoodFET - Silicon Lab C2

import sys;
import binascii;
import array;
import pdb;
import time;

from GoodFETSLC2 import GoodFETSLC2;
from intelhex import IntelHex;



#Initialize FET and set baud rate
#pdb.set_trace();
client=GoodFETSLC2();
client.serInit();

if(sys.argv[1]=="devid"):
    client.setup();
    data = client.getrevid();
    #pdb.set_trace();
    print "dumping contents of 8051 FLASH in dump.txt";
    file = open("dump.bin", mode='wb')
    address = 0;
    while address < 65535:
    	data = client.peekblock(address,2);
	address+= 2;
	for j in data:
	    print j;
            file.write(j);
    file.close();


